import Cookies from 'js-cookie'
import StrUtils from "@/utils/StrUtils"

const userIdKey = "sxf_theater_user_id"

export const getCookieUserId = () => {
	const value = Cookies.get(userIdKey)
	if (!StrUtils.isEmpty(value)) {
		if (typeof(value) == "string" && value == "undefined") {
			return undefined
		}
	}
	return value
}

export const setCookieUserId = (userId) => {
	return Cookies.set(userIdKey, userId)
}

export const removeCookieUserId = () => {
	return Cookies.remove(userIdKey)
}

export default {
	getCookieUserId,
	setCookieUserId,
	removeCookieUserId
}